package com.example.husbandry_online.retrofit;


import android.util.Log;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;


public class ServiceGetter {
    private static Retrofit retrofit;
    public static <T> T getService(Class<T> serviceClass){
        Log.v("ljh","下面是if");
        if (retrofit == null){
            synchronized (ServiceGetter.class){
                if(retrofit == null){
                    retrofit = new Retrofit.Builder()//10.128.134.249 10.129.38.23
                            .baseUrl("http://39.105.9.158/user/")
                            .addConverterFactory(GsonConverterFactory.create())
                            .build();
                    Log.v("ljh","retrofit是否为空"+retrofit.toString()+"sss");
                }
            }
        }
        Log.v("ljh","retrofit是否为空"+retrofit.toString()+"sss");
        return retrofit.create(serviceClass);
    }
    private ServiceGetter() {
    }
}
